<?php
    ####################################################
    # library import and object instance.              #
    ####################################################
    include_once('./common.php');
    include_once('./app_common.php');


    ####################################################
    # request data($_POST AND $_GET FROM $_REQUEST)    #
    ####################################################
    # REQUEST(get and post variables)
    $req = Request::clean_request($_REQUEST, FALSE);

    # GET(url variables)

    # POST(form variables)

    # Validation(special case validate)
    //*/
    #@@todo : php server validation
    Validation::check_isnt_key_val($req, 'fuid');
    Validation::check_is_emptys($req);
    //*/

    ####################################################
    # implementation                                   #
    ####################################################

    //*/
    $article = $db->get(
        sprintf("SELECT * FROM `%s` WHERE `%s`= '%s'",
            $ncrud['table_name'],
            'fuid',
            $req['fuid']
        )
    );
    //*/
?>
<?php
    $html->custom_header(TITLE);
    $html->custom_js("{$JS}jquery.1.7.1.min.js");
    $html->custom_js("{$JS}lib.control.js");
    $html->custom_css("{$CSS}basic.css");
?>
<script type="text/javascript" language="javascript">
//<![CDATA[
    var PageAction = {
        validate:function(){
            //*/
            /* @@todo : javascript validation */
            var check = [
                Validation.check_is_null("#name", "name을 입력 하세요."),
                Validation.check_is_null("#name_eng", "name_eng을 입력 하세요."),
                Validation.check_is_do_not_chooesed("enable", "enable을 선택 하세요."),
                Validation.check_is_null_textarea("#description", "description을 입력 하세요.")
            ];
            return Validation.check(check);
            //*/
        }
    }
//]]>
</script>
<?$html->custom_body();?>
<?=$tmp->tiles_header()?>
<h1>app - update</h1>
<form action="./app_update_proc.php" id="formx" name="formx" method="post" onsubmit="return PageAction.validate();">
        <table width="100%" border="1" cellspacing="0" cellpadding="3" style="border-collapse:collapse">
            <tr>
                <th>
                    fuid
                </th>
                <td>
                    <input type='hidden' name='fuid' id='fuid' value='<?=$article['res'][fuid]?>' /><?=$article['res'][fuid]?>
                </td>
            </tr>
            <tr>
                <th>
                    name
                </th>
                <td>
                    <input type="text" name="name" id="name" value='<?=$article['res'][name]?>' />
                </td>
            </tr>
            <tr>
                <th>
                    name_eng
                </th>
                <td>
                    <input type="text" name="name_eng" id="name_eng" value='<?=$article['res'][name_eng]?>' />
                </td>
            </tr>
            <tr>
                <th>
                    enable
                </th>
                <td>
                    <label><input type="radio"name="enable" id="enable" value='Y' <?=NForm::checked($article['res'][enable], "Y")?> />Y</label>
                    <label><input type="radio"name="enable" id="enable" value='N' <?=NForm::checked($article['res'][enable], "N")?> />N</label>
                </td>
            </tr>
            <tr>
                <th>
                    description
                </th>
                <td>
                    <textarea name="description" id="description" rows="5" cols="80" ><?=$article['res'][description]?></textarea>
                </td>
            </tr>
            <tr>
                <th colspan="2">
                    <?=NTool::submit_btn();?>
                </th>
            </tr>
        </table>
</form>
    <?=NTool::btn("retrieve", "Mover.href('./app_retrieve.php?fuid={$article['res']['fuid']}');")?>
    <?=NTool::btn("list", "Mover.href('./app_list.php');");?>
    <span> | </span>
    <?=NTool::btn("back", "Mover.back();");?>
    <?=NTool::btn("index", "Mover.home();");?>
<?=$tmp->tiles_footer()?>
<?php $html->html_footer(); ?>

